<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<body>
<?php
include "class.phpmailer.php"; 
include "class.smtp.php"; 
 
 function SendMail($username,$password,$from_,$to_,$fromname_,$name_,$tieude,$noidung)
 {
	 $mail = new PHPMailer();
	 $mail->IsSMTP();
	 $mail->Host = "smtp.gmail.com"; 
	 $mail->Port = 465;
	 $mail->SMTPAuth = true;
	 $mail->SMTPAuth = true;
	 $mail->SMTPSecure = 'ssl';
	 $mail->Username = $username; // your SMTP username or your gmail username
	 $mail->Password = $password; // your SMTP password or your gmail password
	$mail->From = $from_;
	$mail->FromName = $fromname_; // Name to indicate where the email came from when the recepient received
	$mail->AddAddress($to_,$name_);
	//$mail->AddReplyTo($from,"Vo Duy Tuan");
	$mail->WordWrap = 50; // set word wrap
	$mail->IsHTML(true); // send as HTML
	$mail->Subject = $tieude;
	$mail->Body = $noidung; //HTML Body
	$mail->AltBody = "Mail nay duoc goi bang phpmailer class"; //Text Body
	if(!$mail->Send())
	{
		echo "<h1>Loi khi goi mail: " . $mail->ErrorInfo . '</h1>';
	}
	else
	{
		echo "<h1>Send mail thanh cong: ".$to_."</h1>";
	}
		 
		
}

SendMail("ltbaogt@gmail.com","lieuthaiba321","ltbaogt@gmail.com","ltbaogt@yahoo.com","BAO GMAIL","ANH SI","TIEU DE","NOI DUNG");

 
?>

</body>
</html>